<script>
	export default {
		data() {
			return {
				user_Count:0
			}
		},
		onLaunch: function() {
			if(this.token){
				this.getUSER()
				this.tui.getWallet()
			}
			this.getCategory()
		},
		onShow() {
			// #ifdef APP-PLUS
			//处理网页唤起app
			var args = plus.runtime.arguments;
			console.log('args',args);
			if(args){
				setTimeout(()=>{
					uni.switchTab({
						url:'/pages/TabBars/home'
					})
				},100)
			} 
			// #endif
		},
		onHide: function() {
			//清除唤起参数
			// #ifdef APP-PLUS
			plus.runtime.arguments = null;
			plus.runtime.arguments = ''
			// #endif
		},
		computed: {
			USER(){
				return this.$store.state.auth.USER
			},
			token(){
				return this.$store.state.auth.UserToken
			}
		},
		methods:{
			//获取用户信息
			getUSER() {
				this.$store.dispatch('auth/user').then(res => {}).catch(error=>{
					//进行操作
					this.user_Count ++
					if(this.user_Count < 4){
						this.getUSER()
					}
				})
			},
			//获取类型列表
			getCategory(){
				this.$store.dispatch('works/category').then(res=>{})
			}
		}
	}
</script>

<style lang="scss">
	@import "./uni_modules/vk-uview-ui/index.scss";
	@import '@/common/uni.css';
	@import '@/common/fonts/font-style.css';
	@import '@/common/public-style.css';
</style>
